/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import entity.Stakeholder;
import session.stateless.StakeholderSessionLocal;

/**
 *
 * @author Jacko
 */
public class StakeholderManager {

    private StakeholderSessionLocal stakeholderSessionLocal;

    public StakeholderManager() {
    }

    public StakeholderManager(StakeholderSessionLocal stakeholderSessionLocal) {
        this.stakeholderSessionLocal = stakeholderSessionLocal;
    }

    public Long doLogin(String username, String password) {
        Stakeholder stakeholder = stakeholderSessionLocal.getStakeholder(username);

        if (stakeholder == null) {
            return null;
        } else {
            if (stakeholder.getPassword().equals(password)) {
                return stakeholder.getStakeID();
            } else {
                return null;
            }
        }
    }
}
